{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>first</th>\n",
       "      <th>last</th>\n",
       "      <th>email</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>Corey</td>\n",
       "      <td>Schafer</td>\n",
       "      <td>CoreyMSchafer@gmail.com</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>Jane</td>\n",
       "      <td>Doe</td>\n",
       "      <td>JaneDoe@email.com</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>John</td>\n",
       "      <td>Doe</td>\n",
       "      <td>JohnDoe@email.com</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   first     last                    email\n",
       "0  Corey  Schafer  CoreyMSchafer@gmail.com\n",
       "1   Jane      Doe        JaneDoe@email.com\n",
       "2   John      Doe        JohnDoe@email.com"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "people = {\n",
    "    \"first\": [\"Corey\", 'Jane', 'John'], \n",
    "    \"last\": [\"Schafer\", 'Doe', 'Doe'], \n",
    "    \"email\": [\"CoreyMSchafer@gmail.com\", 'JaneDoe@email.com', 'JohnDoe@email.com']\n",
    "}\n",
    "\n",
    "df = pd.DataFrame(people)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "E:\\Anaconda\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3058: DtypeWarning: Columns (8,12,13,14,15,16,50,51,52,53,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    }
   ],
   "source": [
    "df = pd.read_csv('survey_results_public.csv',index_col='Respondent')\n",
    "schema_df = pd.read_csv('survey_results_schema.csv',index_col='Column')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "1                No\n",
       "3                No\n",
       "4                No\n",
       "5                No\n",
       "7    Yes, part-time\n",
       "Name: Student, dtype: object"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Student'].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Hobby</th>\n",
       "      <th>OpenSource</th>\n",
       "      <th>Country</th>\n",
       "      <th>Student</th>\n",
       "      <th>Employment</th>\n",
       "      <th>FormalEducation</th>\n",
       "      <th>UndergradMajor</th>\n",
       "      <th>CompanySize</th>\n",
       "      <th>DevType</th>\n",
       "      <th>YearsCoding</th>\n",
       "      <th>...</th>\n",
       "      <th>Exercise</th>\n",
       "      <th>Gender</th>\n",
       "      <th>SexualOrientation</th>\n",
       "      <th>EducationParents</th>\n",
       "      <th>RaceEthnicity</th>\n",
       "      <th>Age</th>\n",
       "      <th>Dependents</th>\n",
       "      <th>MilitaryUS</th>\n",
       "      <th>SurveyTooLong</th>\n",
       "      <th>SurveyEasy</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Respondent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Kenya</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed part-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Mathematics or statistics</td>\n",
       "      <td>20 to 99 employees</td>\n",
       "      <td>Full-stack developer</td>\n",
       "      <td>3-5 years</td>\n",
       "      <td>...</td>\n",
       "      <td>3 - 4 times per week</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Black or of African descent</td>\n",
       "      <td>25 - 34 years old</td>\n",
       "      <td>Yes</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Very easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>A natural science (ex. biology, chemistry, phy...</td>\n",
       "      <td>10,000 or more employees</td>\n",
       "      <td>Database administrator;DevOps specialist;Full-...</td>\n",
       "      <td>30 or more years</td>\n",
       "      <td>...</td>\n",
       "      <td>Daily or almost every day</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>Yes</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Associate degree</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>20 to 99 employees</td>\n",
       "      <td>Engineering manager;Full-stack developer</td>\n",
       "      <td>24-26 years</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>100 to 499 employees</td>\n",
       "      <td>Full-stack developer</td>\n",
       "      <td>18-20 years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>7</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>South Africa</td>\n",
       "      <td>Yes, part-time</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>10,000 or more employees</td>\n",
       "      <td>Data or business analyst;Desktop or enterprise...</td>\n",
       "      <td>6-8 years</td>\n",
       "      <td>...</td>\n",
       "      <td>3 - 4 times per week</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>18 - 24 years old</td>\n",
       "      <td>Yes</td>\n",
       "      <td>NaN</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101513</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101531</td>\n",
       "      <td>No</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Spain</td>\n",
       "      <td>Yes, full-time</td>\n",
       "      <td>Not employed, but looking for work</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Back-end developer;Front-end developer</td>\n",
       "      <td>0-2 years</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101541</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>India</td>\n",
       "      <td>Yes, full-time</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101544</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>Russian Federation</td>\n",
       "      <td>No</td>\n",
       "      <td>Independent contractor, freelancer, or self-em...</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101548</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Cambodia</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>98855 rows × 128 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Hobby OpenSource             Country         Student  \\\n",
       "Respondent                                                        \n",
       "1            Yes         No               Kenya              No   \n",
       "3            Yes        Yes      United Kingdom              No   \n",
       "4            Yes        Yes       United States              No   \n",
       "5             No         No       United States              No   \n",
       "7            Yes         No        South Africa  Yes, part-time   \n",
       "...          ...        ...                 ...             ...   \n",
       "101513       Yes        Yes       United States             NaN   \n",
       "101531        No        Yes               Spain  Yes, full-time   \n",
       "101541       Yes        Yes               India  Yes, full-time   \n",
       "101544       Yes         No  Russian Federation              No   \n",
       "101548       Yes        Yes            Cambodia             NaN   \n",
       "\n",
       "                                                   Employment  \\\n",
       "Respondent                                                      \n",
       "1                                          Employed part-time   \n",
       "3                                          Employed full-time   \n",
       "4                                          Employed full-time   \n",
       "5                                          Employed full-time   \n",
       "7                                          Employed full-time   \n",
       "...                                                       ...   \n",
       "101513                                                    NaN   \n",
       "101531                     Not employed, but looking for work   \n",
       "101541                                     Employed full-time   \n",
       "101544      Independent contractor, freelancer, or self-em...   \n",
       "101548                                                    NaN   \n",
       "\n",
       "                                              FormalEducation  \\\n",
       "Respondent                                                      \n",
       "1                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "3                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "4                                            Associate degree   \n",
       "5                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "7           Some college/university study without earning ...   \n",
       "...                                                       ...   \n",
       "101513                                                    NaN   \n",
       "101531                                                    NaN   \n",
       "101541               Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "101544      Some college/university study without earning ...   \n",
       "101548                                                    NaN   \n",
       "\n",
       "                                               UndergradMajor  \\\n",
       "Respondent                                                      \n",
       "1                                   Mathematics or statistics   \n",
       "3           A natural science (ex. biology, chemistry, phy...   \n",
       "4           Computer science, computer engineering, or sof...   \n",
       "5           Computer science, computer engineering, or sof...   \n",
       "7           Computer science, computer engineering, or sof...   \n",
       "...                                                       ...   \n",
       "101513                                                    NaN   \n",
       "101531                                                    NaN   \n",
       "101541                                                    NaN   \n",
       "101544                                                    NaN   \n",
       "101548                                                    NaN   \n",
       "\n",
       "                         CompanySize  \\\n",
       "Respondent                             \n",
       "1                 20 to 99 employees   \n",
       "3           10,000 or more employees   \n",
       "4                 20 to 99 employees   \n",
       "5               100 to 499 employees   \n",
       "7           10,000 or more employees   \n",
       "...                              ...   \n",
       "101513                           NaN   \n",
       "101531                           NaN   \n",
       "101541                           NaN   \n",
       "101544                           NaN   \n",
       "101548                           NaN   \n",
       "\n",
       "                                                      DevType  \\\n",
       "Respondent                                                      \n",
       "1                                        Full-stack developer   \n",
       "3           Database administrator;DevOps specialist;Full-...   \n",
       "4                    Engineering manager;Full-stack developer   \n",
       "5                                        Full-stack developer   \n",
       "7           Data or business analyst;Desktop or enterprise...   \n",
       "...                                                       ...   \n",
       "101513                                                    NaN   \n",
       "101531                 Back-end developer;Front-end developer   \n",
       "101541                                                    NaN   \n",
       "101544                                                    NaN   \n",
       "101548                                                    NaN   \n",
       "\n",
       "                 YearsCoding  ...                    Exercise Gender  \\\n",
       "Respondent                    ...                                      \n",
       "1                  3-5 years  ...        3 - 4 times per week   Male   \n",
       "3           30 or more years  ...   Daily or almost every day   Male   \n",
       "4                24-26 years  ...                         NaN    NaN   \n",
       "5                18-20 years  ...  I don't typically exercise   Male   \n",
       "7                  6-8 years  ...        3 - 4 times per week   Male   \n",
       "...                      ...  ...                         ...    ...   \n",
       "101513                   NaN  ...                         NaN    NaN   \n",
       "101531             0-2 years  ...                         NaN    NaN   \n",
       "101541                   NaN  ...                         NaN    NaN   \n",
       "101544                   NaN  ...                         NaN    NaN   \n",
       "101548                   NaN  ...                         NaN    NaN   \n",
       "\n",
       "                   SexualOrientation  \\\n",
       "Respondent                             \n",
       "1           Straight or heterosexual   \n",
       "3           Straight or heterosexual   \n",
       "4                                NaN   \n",
       "5           Straight or heterosexual   \n",
       "7           Straight or heterosexual   \n",
       "...                              ...   \n",
       "101513                           NaN   \n",
       "101531                           NaN   \n",
       "101541                           NaN   \n",
       "101544                           NaN   \n",
       "101548                           NaN   \n",
       "\n",
       "                                             EducationParents  \\\n",
       "Respondent                                                      \n",
       "1                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "3                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "4                                                         NaN   \n",
       "5           Some college/university study without earning ...   \n",
       "7           Some college/university study without earning ...   \n",
       "...                                                       ...   \n",
       "101513                                                    NaN   \n",
       "101531                                                    NaN   \n",
       "101541                                                    NaN   \n",
       "101544                                                    NaN   \n",
       "101548                                                    NaN   \n",
       "\n",
       "                           RaceEthnicity                Age  Dependents  \\\n",
       "Respondent                                                                \n",
       "1            Black or of African descent  25 - 34 years old         Yes   \n",
       "3           White or of European descent  35 - 44 years old         Yes   \n",
       "4                                    NaN                NaN         NaN   \n",
       "5           White or of European descent  35 - 44 years old          No   \n",
       "7           White or of European descent  18 - 24 years old         Yes   \n",
       "...                                  ...                ...         ...   \n",
       "101513                               NaN                NaN         NaN   \n",
       "101531                               NaN                NaN         NaN   \n",
       "101541                               NaN                NaN         NaN   \n",
       "101544                               NaN                NaN         NaN   \n",
       "101548                               NaN                NaN         NaN   \n",
       "\n",
       "            MilitaryUS                         SurveyTooLong     SurveyEasy  \n",
       "Respondent                                                                   \n",
       "1                  NaN  The survey was an appropriate length      Very easy  \n",
       "3                  NaN  The survey was an appropriate length  Somewhat easy  \n",
       "4                  NaN                                   NaN            NaN  \n",
       "5                   No  The survey was an appropriate length  Somewhat easy  \n",
       "7                  NaN  The survey was an appropriate length  Somewhat easy  \n",
       "...                ...                                   ...            ...  \n",
       "101513             NaN                                   NaN            NaN  \n",
       "101531             NaN                                   NaN            NaN  \n",
       "101541             NaN                                   NaN            NaN  \n",
       "101544             NaN                                   NaN            NaN  \n",
       "101548             NaN                                   NaN            NaN  \n",
       "\n",
       "[98855 rows x 128 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.0"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['AssessBenefits7'].median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "AssessJob1                   7.0\n",
       "AssessJob2                   7.0\n",
       "AssessJob3                   6.0\n",
       "AssessJob4                   4.0\n",
       "AssessJob5                   3.0\n",
       "AssessJob6                   4.0\n",
       "AssessJob7                   6.0\n",
       "AssessJob8                   4.0\n",
       "AssessJob9                   8.0\n",
       "AssessJob10                  6.0\n",
       "AssessBenefits1              1.0\n",
       "AssessBenefits2              6.0\n",
       "AssessBenefits3              4.0\n",
       "AssessBenefits4              8.0\n",
       "AssessBenefits5              7.0\n",
       "AssessBenefits6              5.0\n",
       "AssessBenefits7              7.0\n",
       "AssessBenefits8              5.0\n",
       "AssessBenefits9              9.0\n",
       "AssessBenefits10             7.0\n",
       "AssessBenefits11             6.0\n",
       "JobContactPriorities1        3.0\n",
       "JobContactPriorities2        1.0\n",
       "JobContactPriorities3        4.0\n",
       "JobContactPriorities4        3.0\n",
       "JobContactPriorities5        4.0\n",
       "JobEmailPriorities1          4.0\n",
       "JobEmailPriorities2          4.0\n",
       "JobEmailPriorities3          4.0\n",
       "JobEmailPriorities4          3.0\n",
       "JobEmailPriorities5          3.0\n",
       "JobEmailPriorities6          5.0\n",
       "JobEmailPriorities7          5.0\n",
       "ConvertedSalary          55075.0\n",
       "AdsPriorities1               2.0\n",
       "AdsPriorities2               4.0\n",
       "AdsPriorities3               3.0\n",
       "AdsPriorities4               4.0\n",
       "AdsPriorities5               5.0\n",
       "AdsPriorities6               6.0\n",
       "AdsPriorities7               5.0\n",
       "dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AssessJob1</th>\n",
       "      <th>AssessJob2</th>\n",
       "      <th>AssessJob3</th>\n",
       "      <th>AssessJob4</th>\n",
       "      <th>AssessJob5</th>\n",
       "      <th>AssessJob6</th>\n",
       "      <th>AssessJob7</th>\n",
       "      <th>AssessJob8</th>\n",
       "      <th>AssessJob9</th>\n",
       "      <th>AssessJob10</th>\n",
       "      <th>...</th>\n",
       "      <th>JobEmailPriorities6</th>\n",
       "      <th>JobEmailPriorities7</th>\n",
       "      <th>ConvertedSalary</th>\n",
       "      <th>AdsPriorities1</th>\n",
       "      <th>AdsPriorities2</th>\n",
       "      <th>AdsPriorities3</th>\n",
       "      <th>AdsPriorities4</th>\n",
       "      <th>AdsPriorities5</th>\n",
       "      <th>AdsPriorities6</th>\n",
       "      <th>AdsPriorities7</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>count</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>66985.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>46213.00000</td>\n",
       "      <td>46213.000000</td>\n",
       "      <td>4.770200e+04</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "      <td>60479.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>mean</td>\n",
       "      <td>6.397089</td>\n",
       "      <td>6.673524</td>\n",
       "      <td>5.906875</td>\n",
       "      <td>4.065791</td>\n",
       "      <td>3.953243</td>\n",
       "      <td>4.407196</td>\n",
       "      <td>5.673181</td>\n",
       "      <td>4.225200</td>\n",
       "      <td>7.640009</td>\n",
       "      <td>6.057804</td>\n",
       "      <td>...</td>\n",
       "      <td>4.97425</td>\n",
       "      <td>4.836388</td>\n",
       "      <td>9.578086e+04</td>\n",
       "      <td>2.726880</td>\n",
       "      <td>3.805784</td>\n",
       "      <td>3.340945</td>\n",
       "      <td>3.782470</td>\n",
       "      <td>4.383604</td>\n",
       "      <td>5.138809</td>\n",
       "      <td>4.821459</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>std</td>\n",
       "      <td>2.788428</td>\n",
       "      <td>2.531202</td>\n",
       "      <td>2.642734</td>\n",
       "      <td>2.541196</td>\n",
       "      <td>2.520499</td>\n",
       "      <td>2.502069</td>\n",
       "      <td>2.923998</td>\n",
       "      <td>2.507411</td>\n",
       "      <td>2.407457</td>\n",
       "      <td>2.663405</td>\n",
       "      <td>...</td>\n",
       "      <td>1.86063</td>\n",
       "      <td>1.659844</td>\n",
       "      <td>2.023482e+05</td>\n",
       "      <td>1.881078</td>\n",
       "      <td>1.821323</td>\n",
       "      <td>1.673485</td>\n",
       "      <td>1.844864</td>\n",
       "      <td>1.931746</td>\n",
       "      <td>1.853249</td>\n",
       "      <td>1.874895</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>min</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.00000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>25%</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>4.00000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>2.384400e+04</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>50%</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>5.00000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>5.507500e+04</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>75%</td>\n",
       "      <td>9.000000</td>\n",
       "      <td>9.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>7.00000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>9.300000e+04</td>\n",
       "      <td>4.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>max</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>7.00000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>2.000000e+06</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "      <td>7.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 41 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         AssessJob1    AssessJob2    AssessJob3    AssessJob4    AssessJob5  \\\n",
       "count  66985.000000  66985.000000  66985.000000  66985.000000  66985.000000   \n",
       "mean       6.397089      6.673524      5.906875      4.065791      3.953243   \n",
       "std        2.788428      2.531202      2.642734      2.541196      2.520499   \n",
       "min        1.000000      1.000000      1.000000      1.000000      1.000000   \n",
       "25%        4.000000      5.000000      4.000000      2.000000      2.000000   \n",
       "50%        7.000000      7.000000      6.000000      4.000000      3.000000   \n",
       "75%        9.000000      9.000000      8.000000      6.000000      6.000000   \n",
       "max       10.000000     10.000000     10.000000     10.000000     10.000000   \n",
       "\n",
       "         AssessJob6    AssessJob7    AssessJob8    AssessJob9   AssessJob10  \\\n",
       "count  66985.000000  66985.000000  66985.000000  66985.000000  66985.000000   \n",
       "mean       4.407196      5.673181      4.225200      7.640009      6.057804   \n",
       "std        2.502069      2.923998      2.507411      2.407457      2.663405   \n",
       "min        1.000000      1.000000      1.000000      1.000000      1.000000   \n",
       "25%        2.000000      3.000000      2.000000      6.000000      4.000000   \n",
       "50%        4.000000      6.000000      4.000000      8.000000      6.000000   \n",
       "75%        6.000000      8.000000      6.000000     10.000000      8.000000   \n",
       "max       10.000000     10.000000     10.000000     10.000000     10.000000   \n",
       "\n",
       "       ...  JobEmailPriorities6  JobEmailPriorities7  ConvertedSalary  \\\n",
       "count  ...          46213.00000         46213.000000     4.770200e+04   \n",
       "mean   ...              4.97425             4.836388     9.578086e+04   \n",
       "std    ...              1.86063             1.659844     2.023482e+05   \n",
       "min    ...              1.00000             1.000000     0.000000e+00   \n",
       "25%    ...              4.00000             4.000000     2.384400e+04   \n",
       "50%    ...              5.00000             5.000000     5.507500e+04   \n",
       "75%    ...              7.00000             6.000000     9.300000e+04   \n",
       "max    ...              7.00000             7.000000     2.000000e+06   \n",
       "\n",
       "       AdsPriorities1  AdsPriorities2  AdsPriorities3  AdsPriorities4  \\\n",
       "count    60479.000000    60479.000000    60479.000000    60479.000000   \n",
       "mean         2.726880        3.805784        3.340945        3.782470   \n",
       "std          1.881078        1.821323        1.673485        1.844864   \n",
       "min          1.000000        1.000000        1.000000        1.000000   \n",
       "25%          1.000000        2.000000        2.000000        2.000000   \n",
       "50%          2.000000        4.000000        3.000000        4.000000   \n",
       "75%          4.000000        5.000000        5.000000        5.000000   \n",
       "max          7.000000        7.000000        7.000000        7.000000   \n",
       "\n",
       "       AdsPriorities5  AdsPriorities6  AdsPriorities7  \n",
       "count    60479.000000    60479.000000    60479.000000  \n",
       "mean         4.383604        5.138809        4.821459  \n",
       "std          1.931746        1.853249        1.874895  \n",
       "min          1.000000        1.000000        1.000000  \n",
       "25%          3.000000        4.000000        3.000000  \n",
       "50%          5.000000        6.000000        5.000000  \n",
       "75%          6.000000        7.000000        7.000000  \n",
       "max          7.000000        7.000000        7.000000  \n",
       "\n",
       "[8 rows x 41 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "47702"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['ConvertedSalary'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "1         Yes\n",
       "3         Yes\n",
       "4         Yes\n",
       "5          No\n",
       "7         Yes\n",
       "         ... \n",
       "101513    Yes\n",
       "101531     No\n",
       "101541    Yes\n",
       "101544    Yes\n",
       "101548    Yes\n",
       "Name: Hobby, Length: 98855, dtype: object"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Hobby']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Yes    79897\n",
       "No     18958\n",
       "Name: Hobby, dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Hobby'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "1                      Kenya\n",
       "3             United Kingdom\n",
       "4              United States\n",
       "5              United States\n",
       "7               South Africa\n",
       "                 ...        \n",
       "101513         United States\n",
       "101531                 Spain\n",
       "101541                 India\n",
       "101544    Russian Federation\n",
       "101548              Cambodia\n",
       "Name: Country, Length: 98855, dtype: object"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Country']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "QuestionText    In which country do you currently reside?\n",
       "Name: Country, dtype: object"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schema_df.loc['Country']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "United States     20309\n",
       "India             13721\n",
       "Germany            6459\n",
       "United Kingdom     6221\n",
       "Canada             3393\n",
       "                  ...  \n",
       "Saint Lucia           1\n",
       "Grenada               1\n",
       "Belize                1\n",
       "Nauru                 1\n",
       "Djibouti              1\n",
       "Name: Country, Length: 183, dtype: int64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Country'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "United States     0.206302\n",
       "India             0.139380\n",
       "Germany           0.065612\n",
       "United Kingdom    0.063194\n",
       "Canada            0.034467\n",
       "                    ...   \n",
       "Saint Lucia       0.000010\n",
       "Grenada           0.000010\n",
       "Belize            0.000010\n",
       "Nauru             0.000010\n",
       "Djibouti          0.000010\n",
       "Name: Country, Length: 183, dtype: float64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Country'].value_counts(normalize=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "1                      Kenya\n",
       "3             United Kingdom\n",
       "4              United States\n",
       "5              United States\n",
       "7               South Africa\n",
       "                 ...        \n",
       "101513         United States\n",
       "101531                 Spain\n",
       "101541                 India\n",
       "101544    Russian Federation\n",
       "101548              Cambodia\n",
       "Name: Country, Length: 98855, dtype: object"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Country']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "United States     20309\n",
       "India             13721\n",
       "Germany            6459\n",
       "United Kingdom     6221\n",
       "Canada             3393\n",
       "                  ...  \n",
       "Saint Lucia           1\n",
       "Grenada               1\n",
       "Belize                1\n",
       "Nauru                 1\n",
       "Djibouti              1\n",
       "Name: Country, Length: 183, dtype: int64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Country'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<pandas.core.groupby.generic.DataFrameGroupBy object at 0x00000282B42FB1C8>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby(df['Country'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "Country_grp = df.groupby(df['Country'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Hobby</th>\n",
       "      <th>OpenSource</th>\n",
       "      <th>Country</th>\n",
       "      <th>Student</th>\n",
       "      <th>Employment</th>\n",
       "      <th>FormalEducation</th>\n",
       "      <th>UndergradMajor</th>\n",
       "      <th>CompanySize</th>\n",
       "      <th>DevType</th>\n",
       "      <th>YearsCoding</th>\n",
       "      <th>...</th>\n",
       "      <th>Exercise</th>\n",
       "      <th>Gender</th>\n",
       "      <th>SexualOrientation</th>\n",
       "      <th>EducationParents</th>\n",
       "      <th>RaceEthnicity</th>\n",
       "      <th>Age</th>\n",
       "      <th>Dependents</th>\n",
       "      <th>MilitaryUS</th>\n",
       "      <th>SurveyTooLong</th>\n",
       "      <th>SurveyEasy</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Respondent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Associate degree</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>20 to 99 employees</td>\n",
       "      <td>Engineering manager;Full-stack developer</td>\n",
       "      <td>24-26 years</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>100 to 499 employees</td>\n",
       "      <td>Full-stack developer</td>\n",
       "      <td>18-20 years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>10,000 or more employees</td>\n",
       "      <td>Back-end developer;Front-end developer;Full-st...</td>\n",
       "      <td>9-11 years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Master’s degree (MA, MS, M.Eng., MBA, etc.)</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>18 - 24 years old</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>Fine arts or performing arts (ex. graphic desi...</td>\n",
       "      <td>100 to 499 employees</td>\n",
       "      <td>Back-end developer;C-suite executive (CEO, CTO...</td>\n",
       "      <td>30 or more years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Very easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>26</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>Yes, full-time</td>\n",
       "      <td>Employed part-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>1,000 to 4,999 employees</td>\n",
       "      <td>Student</td>\n",
       "      <td>0-2 years</td>\n",
       "      <td>...</td>\n",
       "      <td>3 - 4 times per week</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>100432</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>100680</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101006</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101411</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101513</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20309 rows × 128 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Hobby OpenSource        Country         Student  \\\n",
       "Respondent                                                   \n",
       "4            Yes        Yes  United States              No   \n",
       "5             No         No  United States              No   \n",
       "9            Yes        Yes  United States              No   \n",
       "11           Yes        Yes  United States              No   \n",
       "26            No         No  United States  Yes, full-time   \n",
       "...          ...        ...            ...             ...   \n",
       "100432        No         No  United States              No   \n",
       "100680       Yes         No  United States              No   \n",
       "101006       Yes        Yes  United States             NaN   \n",
       "101411        No         No  United States             NaN   \n",
       "101513       Yes        Yes  United States             NaN   \n",
       "\n",
       "                    Employment  \\\n",
       "Respondent                       \n",
       "4           Employed full-time   \n",
       "5           Employed full-time   \n",
       "9           Employed full-time   \n",
       "11          Employed full-time   \n",
       "26          Employed part-time   \n",
       "...                        ...   \n",
       "100432      Employed full-time   \n",
       "100680      Employed full-time   \n",
       "101006                     NaN   \n",
       "101411                     NaN   \n",
       "101513                     NaN   \n",
       "\n",
       "                                              FormalEducation  \\\n",
       "Respondent                                                      \n",
       "4                                            Associate degree   \n",
       "5                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "9           Some college/university study without earning ...   \n",
       "11          Some college/university study without earning ...   \n",
       "26                   Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "...                                                       ...   \n",
       "100432               Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "100680               Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                                               UndergradMajor  \\\n",
       "Respondent                                                      \n",
       "4           Computer science, computer engineering, or sof...   \n",
       "5           Computer science, computer engineering, or sof...   \n",
       "9           Computer science, computer engineering, or sof...   \n",
       "11          Fine arts or performing arts (ex. graphic desi...   \n",
       "26          Computer science, computer engineering, or sof...   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                         CompanySize  \\\n",
       "Respondent                             \n",
       "4                 20 to 99 employees   \n",
       "5               100 to 499 employees   \n",
       "9           10,000 or more employees   \n",
       "11              100 to 499 employees   \n",
       "26          1,000 to 4,999 employees   \n",
       "...                              ...   \n",
       "100432                           NaN   \n",
       "100680                           NaN   \n",
       "101006                           NaN   \n",
       "101411                           NaN   \n",
       "101513                           NaN   \n",
       "\n",
       "                                                      DevType  \\\n",
       "Respondent                                                      \n",
       "4                    Engineering manager;Full-stack developer   \n",
       "5                                        Full-stack developer   \n",
       "9           Back-end developer;Front-end developer;Full-st...   \n",
       "11          Back-end developer;C-suite executive (CEO, CTO...   \n",
       "26                                                    Student   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                 YearsCoding  ...                    Exercise Gender  \\\n",
       "Respondent                    ...                                      \n",
       "4                24-26 years  ...                         NaN    NaN   \n",
       "5                18-20 years  ...  I don't typically exercise   Male   \n",
       "9                 9-11 years  ...  I don't typically exercise   Male   \n",
       "11          30 or more years  ...  I don't typically exercise   Male   \n",
       "26                 0-2 years  ...        3 - 4 times per week    NaN   \n",
       "...                      ...  ...                         ...    ...   \n",
       "100432                   NaN  ...                         NaN    NaN   \n",
       "100680                   NaN  ...                         NaN    NaN   \n",
       "101006                   NaN  ...                         NaN    NaN   \n",
       "101411                   NaN  ...                         NaN    NaN   \n",
       "101513                   NaN  ...                         NaN    NaN   \n",
       "\n",
       "                   SexualOrientation  \\\n",
       "Respondent                             \n",
       "4                                NaN   \n",
       "5           Straight or heterosexual   \n",
       "9           Straight or heterosexual   \n",
       "11          Straight or heterosexual   \n",
       "26                               NaN   \n",
       "...                              ...   \n",
       "100432                           NaN   \n",
       "100680                           NaN   \n",
       "101006                           NaN   \n",
       "101411                           NaN   \n",
       "101513                           NaN   \n",
       "\n",
       "                                             EducationParents  \\\n",
       "Respondent                                                      \n",
       "4                                                         NaN   \n",
       "5           Some college/university study without earning ...   \n",
       "9                 Master’s degree (MA, MS, M.Eng., MBA, etc.)   \n",
       "11          Some college/university study without earning ...   \n",
       "26                                                        NaN   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                           RaceEthnicity                Age  Dependents  \\\n",
       "Respondent                                                                \n",
       "4                                    NaN                NaN         NaN   \n",
       "5           White or of European descent  35 - 44 years old          No   \n",
       "9           White or of European descent  18 - 24 years old          No   \n",
       "11          White or of European descent  35 - 44 years old         Yes   \n",
       "26                                   NaN                NaN         NaN   \n",
       "...                                  ...                ...         ...   \n",
       "100432                               NaN                NaN         NaN   \n",
       "100680                               NaN                NaN         NaN   \n",
       "101006                               NaN                NaN         NaN   \n",
       "101411                               NaN                NaN         NaN   \n",
       "101513                               NaN                NaN         NaN   \n",
       "\n",
       "            MilitaryUS                         SurveyTooLong     SurveyEasy  \n",
       "Respondent                                                                   \n",
       "4                  NaN                                   NaN            NaN  \n",
       "5                   No  The survey was an appropriate length  Somewhat easy  \n",
       "9                   No  The survey was an appropriate length  Somewhat easy  \n",
       "11                  No  The survey was an appropriate length      Very easy  \n",
       "26                 NaN                                   NaN            NaN  \n",
       "...                ...                                   ...            ...  \n",
       "100432             NaN                                   NaN            NaN  \n",
       "100680             NaN                                   NaN            NaN  \n",
       "101006             NaN                                   NaN            NaN  \n",
       "101411             NaN                                   NaN            NaN  \n",
       "101513             NaN                                   NaN            NaN  \n",
       "\n",
       "[20309 rows x 128 columns]"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp.get_group('United States')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Hobby</th>\n",
       "      <th>OpenSource</th>\n",
       "      <th>Country</th>\n",
       "      <th>Student</th>\n",
       "      <th>Employment</th>\n",
       "      <th>FormalEducation</th>\n",
       "      <th>UndergradMajor</th>\n",
       "      <th>CompanySize</th>\n",
       "      <th>DevType</th>\n",
       "      <th>YearsCoding</th>\n",
       "      <th>...</th>\n",
       "      <th>Exercise</th>\n",
       "      <th>Gender</th>\n",
       "      <th>SexualOrientation</th>\n",
       "      <th>EducationParents</th>\n",
       "      <th>RaceEthnicity</th>\n",
       "      <th>Age</th>\n",
       "      <th>Dependents</th>\n",
       "      <th>MilitaryUS</th>\n",
       "      <th>SurveyTooLong</th>\n",
       "      <th>SurveyEasy</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Respondent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Associate degree</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>20 to 99 employees</td>\n",
       "      <td>Engineering manager;Full-stack developer</td>\n",
       "      <td>24-26 years</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>5</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>100 to 499 employees</td>\n",
       "      <td>Full-stack developer</td>\n",
       "      <td>18-20 years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>9</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>10,000 or more employees</td>\n",
       "      <td>Back-end developer;Front-end developer;Full-st...</td>\n",
       "      <td>9-11 years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Master’s degree (MA, MS, M.Eng., MBA, etc.)</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>18 - 24 years old</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Somewhat easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>11</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>Fine arts or performing arts (ex. graphic desi...</td>\n",
       "      <td>100 to 499 employees</td>\n",
       "      <td>Back-end developer;C-suite executive (CEO, CTO...</td>\n",
       "      <td>30 or more years</td>\n",
       "      <td>...</td>\n",
       "      <td>I don't typically exercise</td>\n",
       "      <td>Male</td>\n",
       "      <td>Straight or heterosexual</td>\n",
       "      <td>Some college/university study without earning ...</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>35 - 44 years old</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>The survey was an appropriate length</td>\n",
       "      <td>Very easy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>26</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>Yes, full-time</td>\n",
       "      <td>Employed part-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>Computer science, computer engineering, or sof...</td>\n",
       "      <td>1,000 to 4,999 employees</td>\n",
       "      <td>Student</td>\n",
       "      <td>0-2 years</td>\n",
       "      <td>...</td>\n",
       "      <td>3 - 4 times per week</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>100432</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>100680</td>\n",
       "      <td>Yes</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>No</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Bachelor’s degree (BA, BS, B.Eng., etc.)</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101006</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101411</td>\n",
       "      <td>No</td>\n",
       "      <td>No</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>101513</td>\n",
       "      <td>Yes</td>\n",
       "      <td>Yes</td>\n",
       "      <td>United States</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20309 rows × 128 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           Hobby OpenSource        Country         Student  \\\n",
       "Respondent                                                   \n",
       "4            Yes        Yes  United States              No   \n",
       "5             No         No  United States              No   \n",
       "9            Yes        Yes  United States              No   \n",
       "11           Yes        Yes  United States              No   \n",
       "26            No         No  United States  Yes, full-time   \n",
       "...          ...        ...            ...             ...   \n",
       "100432        No         No  United States              No   \n",
       "100680       Yes         No  United States              No   \n",
       "101006       Yes        Yes  United States             NaN   \n",
       "101411        No         No  United States             NaN   \n",
       "101513       Yes        Yes  United States             NaN   \n",
       "\n",
       "                    Employment  \\\n",
       "Respondent                       \n",
       "4           Employed full-time   \n",
       "5           Employed full-time   \n",
       "9           Employed full-time   \n",
       "11          Employed full-time   \n",
       "26          Employed part-time   \n",
       "...                        ...   \n",
       "100432      Employed full-time   \n",
       "100680      Employed full-time   \n",
       "101006                     NaN   \n",
       "101411                     NaN   \n",
       "101513                     NaN   \n",
       "\n",
       "                                              FormalEducation  \\\n",
       "Respondent                                                      \n",
       "4                                            Associate degree   \n",
       "5                    Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "9           Some college/university study without earning ...   \n",
       "11          Some college/university study without earning ...   \n",
       "26                   Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "...                                                       ...   \n",
       "100432               Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "100680               Bachelor’s degree (BA, BS, B.Eng., etc.)   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                                               UndergradMajor  \\\n",
       "Respondent                                                      \n",
       "4           Computer science, computer engineering, or sof...   \n",
       "5           Computer science, computer engineering, or sof...   \n",
       "9           Computer science, computer engineering, or sof...   \n",
       "11          Fine arts or performing arts (ex. graphic desi...   \n",
       "26          Computer science, computer engineering, or sof...   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                         CompanySize  \\\n",
       "Respondent                             \n",
       "4                 20 to 99 employees   \n",
       "5               100 to 499 employees   \n",
       "9           10,000 or more employees   \n",
       "11              100 to 499 employees   \n",
       "26          1,000 to 4,999 employees   \n",
       "...                              ...   \n",
       "100432                           NaN   \n",
       "100680                           NaN   \n",
       "101006                           NaN   \n",
       "101411                           NaN   \n",
       "101513                           NaN   \n",
       "\n",
       "                                                      DevType  \\\n",
       "Respondent                                                      \n",
       "4                    Engineering manager;Full-stack developer   \n",
       "5                                        Full-stack developer   \n",
       "9           Back-end developer;Front-end developer;Full-st...   \n",
       "11          Back-end developer;C-suite executive (CEO, CTO...   \n",
       "26                                                    Student   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                 YearsCoding  ...                    Exercise Gender  \\\n",
       "Respondent                    ...                                      \n",
       "4                24-26 years  ...                         NaN    NaN   \n",
       "5                18-20 years  ...  I don't typically exercise   Male   \n",
       "9                 9-11 years  ...  I don't typically exercise   Male   \n",
       "11          30 or more years  ...  I don't typically exercise   Male   \n",
       "26                 0-2 years  ...        3 - 4 times per week    NaN   \n",
       "...                      ...  ...                         ...    ...   \n",
       "100432                   NaN  ...                         NaN    NaN   \n",
       "100680                   NaN  ...                         NaN    NaN   \n",
       "101006                   NaN  ...                         NaN    NaN   \n",
       "101411                   NaN  ...                         NaN    NaN   \n",
       "101513                   NaN  ...                         NaN    NaN   \n",
       "\n",
       "                   SexualOrientation  \\\n",
       "Respondent                             \n",
       "4                                NaN   \n",
       "5           Straight or heterosexual   \n",
       "9           Straight or heterosexual   \n",
       "11          Straight or heterosexual   \n",
       "26                               NaN   \n",
       "...                              ...   \n",
       "100432                           NaN   \n",
       "100680                           NaN   \n",
       "101006                           NaN   \n",
       "101411                           NaN   \n",
       "101513                           NaN   \n",
       "\n",
       "                                             EducationParents  \\\n",
       "Respondent                                                      \n",
       "4                                                         NaN   \n",
       "5           Some college/university study without earning ...   \n",
       "9                 Master’s degree (MA, MS, M.Eng., MBA, etc.)   \n",
       "11          Some college/university study without earning ...   \n",
       "26                                                        NaN   \n",
       "...                                                       ...   \n",
       "100432                                                    NaN   \n",
       "100680                                                    NaN   \n",
       "101006                                                    NaN   \n",
       "101411                                                    NaN   \n",
       "101513                                                    NaN   \n",
       "\n",
       "                           RaceEthnicity                Age  Dependents  \\\n",
       "Respondent                                                                \n",
       "4                                    NaN                NaN         NaN   \n",
       "5           White or of European descent  35 - 44 years old          No   \n",
       "9           White or of European descent  18 - 24 years old          No   \n",
       "11          White or of European descent  35 - 44 years old         Yes   \n",
       "26                                   NaN                NaN         NaN   \n",
       "...                                  ...                ...         ...   \n",
       "100432                               NaN                NaN         NaN   \n",
       "100680                               NaN                NaN         NaN   \n",
       "101006                               NaN                NaN         NaN   \n",
       "101411                               NaN                NaN         NaN   \n",
       "101513                               NaN                NaN         NaN   \n",
       "\n",
       "            MilitaryUS                         SurveyTooLong     SurveyEasy  \n",
       "Respondent                                                                   \n",
       "4                  NaN                                   NaN            NaN  \n",
       "5                   No  The survey was an appropriate length  Somewhat easy  \n",
       "9                   No  The survey was an appropriate length  Somewhat easy  \n",
       "11                  No  The survey was an appropriate length      Very easy  \n",
       "26                 NaN                                   NaN            NaN  \n",
       "...                ...                                   ...            ...  \n",
       "100432             NaN                                   NaN            NaN  \n",
       "100680             NaN                                   NaN            NaN  \n",
       "101006             NaN                                   NaN            NaN  \n",
       "101411             NaN                                   NaN            NaN  \n",
       "101513             NaN                                   NaN            NaN  \n",
       "\n",
       "[20309 rows x 128 columns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filt = df['Country'] == 'United States'\n",
    "df.loc[filt]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Employed full-time                                      16031\n",
       "Independent contractor, freelancer, or self-employed     1308\n",
       "Not employed, but looking for work                        956\n",
       "Employed part-time                                        870\n",
       "Not employed, and not looking for work                    710\n",
       "Retired                                                    73\n",
       "Name: Employment, dtype: int64"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[filt]['Employment'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country              Employment                                          \n",
       "Afghanistan          Employed full-time                                        23\n",
       "                     Independent contractor, freelancer, or self-employed      11\n",
       "                     Employed part-time                                         6\n",
       "                     Not employed, but looking for work                         5\n",
       "                     Not employed, and not looking for work                     4\n",
       "                     Retired                                                    2\n",
       "Albania              Employed full-time                                        63\n",
       "                     Independent contractor, freelancer, or self-employed      12\n",
       "                     Not employed, but looking for work                        10\n",
       "                     Employed part-time                                         9\n",
       "                     Not employed, and not looking for work                     4\n",
       "                     Retired                                                    1\n",
       "Algeria              Employed full-time                                        45\n",
       "                     Not employed, but looking for work                        30\n",
       "                     Independent contractor, freelancer, or self-employed      17\n",
       "                     Employed part-time                                        11\n",
       "                     Not employed, and not looking for work                    10\n",
       "                     Retired                                                    1\n",
       "Andorra              Employed full-time                                         6\n",
       "                     Independent contractor, freelancer, or self-employed       4\n",
       "                     Not employed, but looking for work                         1\n",
       "Angola               Employed part-time                                         2\n",
       "                     Not employed, but looking for work                         2\n",
       "                     Employed full-time                                         1\n",
       "Antigua and Barbuda  Employed full-time                                         2\n",
       "                     Independent contractor, freelancer, or self-employed       1\n",
       "                     Retired                                                    1\n",
       "Argentina            Employed full-time                                       409\n",
       "                     Independent contractor, freelancer, or self-employed      91\n",
       "                     Employed part-time                                        54\n",
       "                     Not employed, but looking for work                        25\n",
       "                     Not employed, and not looking for work                    20\n",
       "                     Retired                                                    1\n",
       "Armenia              Employed full-time                                        88\n",
       "                     Independent contractor, freelancer, or self-employed       8\n",
       "                     Not employed, but looking for work                         7\n",
       "                     Employed part-time                                         5\n",
       "                     Retired                                                    1\n",
       "Australia            Employed full-time                                      1483\n",
       "                     Independent contractor, freelancer, or self-employed     198\n",
       "                     Employed part-time                                       118\n",
       "                     Not employed, but looking for work                        94\n",
       "                     Not employed, and not looking for work                    71\n",
       "                     Retired                                                    6\n",
       "Austria              Employed full-time                                       469\n",
       "                     Employed part-time                                       125\n",
       "                     Independent contractor, freelancer, or self-employed      98\n",
       "                     Not employed, and not looking for work                    48\n",
       "                     Not employed, but looking for work                        23\n",
       "Azerbaijan           Employed full-time                                        52\n",
       "Name: Employment, dtype: int64"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['Employment'].value_counts().head(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Employment\n",
       "Employed full-time                                      10252\n",
       "Not employed, but looking for work                       1210\n",
       "Independent contractor, freelancer, or self-employed      804\n",
       "Not employed, and not looking for work                    498\n",
       "Employed part-time                                        257\n",
       "Retired                                                     4\n",
       "Name: Employment, dtype: int64"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['Employment'].value_counts().loc['India']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Employment\n",
       "Employed full-time                                      0.787102\n",
       "Not employed, but looking for work                      0.092898\n",
       "Independent contractor, freelancer, or self-employed    0.061727\n",
       "Not employed, and not looking for work                  0.038234\n",
       "Employed part-time                                      0.019731\n",
       "Retired                                                 0.000307\n",
       "Name: Employment, dtype: float64"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['Employment'].value_counts(normalize=True).loc['India']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Employment\n",
       "Employed full-time                                      0.803639\n",
       "Independent contractor, freelancer, or self-employed    0.065570\n",
       "Not employed, but looking for work                      0.047925\n",
       "Employed part-time                                      0.043613\n",
       "Not employed, and not looking for work                  0.035593\n",
       "Retired                                                 0.003660\n",
       "Name: Employment, dtype: float64"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['Employment'].value_counts(normalize=True).loc['United States']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country\n",
       "Afghanistan                               5324.0\n",
       "Albania                                  11748.0\n",
       "Algeria                                   7278.0\n",
       "Andorra                                 525701.5\n",
       "Angola                                       NaN\n",
       "                                          ...   \n",
       "Venezuela, Bolivarian Republic of...      8100.0\n",
       "Viet Nam                                  9516.0\n",
       "Yemen                                     8994.0\n",
       "Zambia                                    1824.0\n",
       "Zimbabwe                                 14610.0\n",
       "Name: ConvertedSalary, Length: 183, dtype: float64"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['ConvertedSalary'].median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "61194.0"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['ConvertedSalary'].median().loc['Germany']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>median</th>\n",
       "      <th>mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>5324.0</td>\n",
       "      <td>62757.857143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Albania</td>\n",
       "      <td>11748.0</td>\n",
       "      <td>23347.638889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Algeria</td>\n",
       "      <td>7278.0</td>\n",
       "      <td>23676.538462</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Andorra</td>\n",
       "      <td>525701.5</td>\n",
       "      <td>525089.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Angola</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Venezuela, Bolivarian Republic of...</td>\n",
       "      <td>8100.0</td>\n",
       "      <td>241823.625000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Viet Nam</td>\n",
       "      <td>9516.0</td>\n",
       "      <td>19001.617284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Yemen</td>\n",
       "      <td>8994.0</td>\n",
       "      <td>8698.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Zambia</td>\n",
       "      <td>1824.0</td>\n",
       "      <td>1824.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>14610.0</td>\n",
       "      <td>92951.428571</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>183 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                        median           mean\n",
       "Country                                                      \n",
       "Afghanistan                             5324.0   62757.857143\n",
       "Albania                                11748.0   23347.638889\n",
       "Algeria                                 7278.0   23676.538462\n",
       "Andorra                               525701.5  525089.500000\n",
       "Angola                                     NaN            NaN\n",
       "...                                        ...            ...\n",
       "Venezuela, Bolivarian Republic of...    8100.0  241823.625000\n",
       "Viet Nam                                9516.0   19001.617284\n",
       "Yemen                                   8994.0    8698.000000\n",
       "Zambia                                  1824.0    1824.000000\n",
       "Zimbabwe                               14610.0   92951.428571\n",
       "\n",
       "[183 rows x 2 columns]"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['ConvertedSalary'].agg(['median','mean'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "median     64417.000000\n",
       "mean      100894.343419\n",
       "Name: Canada, dtype: float64"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['ConvertedSalary'].agg(['median','mean']).loc['Canada']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "16                                           NaN\n",
       "18                                           NaN\n",
       "20                                          Java\n",
       "29                                      C;C++;C#\n",
       "39        C;C++;Java;JavaScript;SQL;Swift;Kotlin\n",
       "                           ...                  \n",
       "101371                                       NaN\n",
       "101391                                       NaN\n",
       "101432                                       NaN\n",
       "101478                                       NaN\n",
       "101541                                       NaN\n",
       "Name: LanguageWorkedWith, Length: 13721, dtype: object"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filt = df['Country'] == 'India'\n",
    "df.loc[filt]['LanguageWorkedWith']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Respondent\n",
       "16          NaN\n",
       "18          NaN\n",
       "20        False\n",
       "29        False\n",
       "39        False\n",
       "          ...  \n",
       "101371      NaN\n",
       "101391      NaN\n",
       "101432      NaN\n",
       "101478      NaN\n",
       "101541      NaN\n",
       "Name: LanguageWorkedWith, Length: 13721, dtype: object"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filt = df['Country'] == 'India'\n",
    "df.loc[filt]['LanguageWorkedWith'].str.contains('Python')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2830"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "filt = df['Country'] == 'India'\n",
    "df.loc[filt]['LanguageWorkedWith'].str.contains('Python').sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "Cannot access attribute 'str' of 'SeriesGroupBy' objects, try using the 'apply' method",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-57-f1c21fa77349>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mCountry_grp\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'LanguageWorkedWith'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstr\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcontains\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'Python'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0msum\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;32mE:\\Anaconda\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36m__getattr__\u001b[1;34m(self, attr)\u001b[0m\n\u001b[0;32m    561\u001b[0m             \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mattr\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    562\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mattr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 563\u001b[1;33m             \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_make_wrapper\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mattr\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    564\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    565\u001b[0m         raise AttributeError(\n",
      "\u001b[1;32mE:\\Anaconda\\lib\\site-packages\\pandas\\core\\groupby\\groupby.py\u001b[0m in \u001b[0;36m_make_wrapper\u001b[1;34m(self, name)\u001b[0m\n\u001b[0;32m    602\u001b[0m                 \u001b[1;34m\"using the 'apply' method\"\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkind\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__name__\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    603\u001b[0m             )\n\u001b[1;32m--> 604\u001b[1;33m             \u001b[1;32mraise\u001b[0m \u001b[0mAttributeError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    605\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    606\u001b[0m         \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_set_group_selection\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mAttributeError\u001b[0m: Cannot access attribute 'str' of 'SeriesGroupBy' objects, try using the 'apply' method"
     ]
    }
   ],
   "source": [
    "Country_grp['LanguageWorkedWith'].str.contains('Python').sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country\n",
       "Afghanistan                              5\n",
       "Albania                                 21\n",
       "Algeria                                 20\n",
       "Andorra                                  1\n",
       "Angola                                   0\n",
       "                                        ..\n",
       "Venezuela, Bolivarian Republic of...    31\n",
       "Viet Nam                                52\n",
       "Yemen                                    0\n",
       "Zambia                                   3\n",
       "Zimbabwe                                 9\n",
       "Name: LanguageWorkedWith, Length: 183, dtype: int64"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "United States     20309\n",
       "India             13721\n",
       "Germany            6459\n",
       "United Kingdom     6221\n",
       "Canada             3393\n",
       "                  ...  \n",
       "Saint Lucia           1\n",
       "Grenada               1\n",
       "Belize                1\n",
       "Nauru                 1\n",
       "Djibouti              1\n",
       "Name: Country, Length: 183, dtype: int64"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_respondents = df['Country'].value_counts()\n",
    "country_respondents"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country\n",
       "Afghanistan                              5\n",
       "Albania                                 21\n",
       "Algeria                                 20\n",
       "Andorra                                  1\n",
       "Angola                                   0\n",
       "                                        ..\n",
       "Venezuela, Bolivarian Republic of...    31\n",
       "Viet Nam                                52\n",
       "Yemen                                    0\n",
       "Zambia                                   3\n",
       "Zimbabwe                                 9\n",
       "Name: LanguageWorkedWith, Length: 183, dtype: int64"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "contry_uses_python = Country_grp['LanguageWorkedWith'].apply(lambda x: x.str.contains('Python').sum())\n",
    "contry_uses_python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>LanguageWorkedWith</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>United States</td>\n",
       "      <td>20309</td>\n",
       "      <td>8324</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>India</td>\n",
       "      <td>13721</td>\n",
       "      <td>2830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Germany</td>\n",
       "      <td>6459</td>\n",
       "      <td>2143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>6221</td>\n",
       "      <td>2175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Canada</td>\n",
       "      <td>3393</td>\n",
       "      <td>1340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saint Lucia</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Grenada</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Belize</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Nauru</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Djibouti</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>183 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                Country  LanguageWorkedWith\n",
       "United States     20309                8324\n",
       "India             13721                2830\n",
       "Germany            6459                2143\n",
       "United Kingdom     6221                2175\n",
       "Canada             3393                1340\n",
       "...                 ...                 ...\n",
       "Saint Lucia           1                   1\n",
       "Grenada               1                   0\n",
       "Belize                1                   0\n",
       "Nauru                 1                   0\n",
       "Djibouti              1                   0\n",
       "\n",
       "[183 rows x 2 columns]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df = pd.concat([country_respondents,contry_uses_python],axis='columns',sort=False)\n",
    "python_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumRespondents</th>\n",
       "      <th>NumKnowsPython</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>United States</td>\n",
       "      <td>20309</td>\n",
       "      <td>8324</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>India</td>\n",
       "      <td>13721</td>\n",
       "      <td>2830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Germany</td>\n",
       "      <td>6459</td>\n",
       "      <td>2143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>6221</td>\n",
       "      <td>2175</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Canada</td>\n",
       "      <td>3393</td>\n",
       "      <td>1340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saint Lucia</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Grenada</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Belize</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Nauru</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Djibouti</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>183 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                NumRespondents  NumKnowsPython\n",
       "United States            20309            8324\n",
       "India                    13721            2830\n",
       "Germany                   6459            2143\n",
       "United Kingdom            6221            2175\n",
       "Canada                    3393            1340\n",
       "...                        ...             ...\n",
       "Saint Lucia                  1               1\n",
       "Grenada                      1               0\n",
       "Belize                       1               0\n",
       "Nauru                        1               0\n",
       "Djibouti                     1               0\n",
       "\n",
       "[183 rows x 2 columns]"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df.rename(columns={'Country':'NumRespondents','LanguageWorkedWith':'NumKnowsPython'},inplace=True)\n",
    "python_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumRespondents</th>\n",
       "      <th>NumKnowsPython</th>\n",
       "      <th>PctKnowsPython</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>United States</td>\n",
       "      <td>20309</td>\n",
       "      <td>8324</td>\n",
       "      <td>40.986755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>India</td>\n",
       "      <td>13721</td>\n",
       "      <td>2830</td>\n",
       "      <td>20.625319</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Germany</td>\n",
       "      <td>6459</td>\n",
       "      <td>2143</td>\n",
       "      <td>33.178511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>6221</td>\n",
       "      <td>2175</td>\n",
       "      <td>34.962225</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Canada</td>\n",
       "      <td>3393</td>\n",
       "      <td>1340</td>\n",
       "      <td>39.493074</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saint Lucia</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Grenada</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Belize</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Nauru</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Djibouti</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>183 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                NumRespondents  NumKnowsPython  PctKnowsPython\n",
       "United States            20309            8324       40.986755\n",
       "India                    13721            2830       20.625319\n",
       "Germany                   6459            2143       33.178511\n",
       "United Kingdom            6221            2175       34.962225\n",
       "Canada                    3393            1340       39.493074\n",
       "...                        ...             ...             ...\n",
       "Saint Lucia                  1               1      100.000000\n",
       "Grenada                      1               0        0.000000\n",
       "Belize                       1               0        0.000000\n",
       "Nauru                        1               0        0.000000\n",
       "Djibouti                     1               0        0.000000\n",
       "\n",
       "[183 rows x 3 columns]"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df['PctKnowsPython'] = (python_df['NumKnowsPython']/python_df['NumRespondents'])*100\n",
    "python_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumRespondents</th>\n",
       "      <th>NumKnowsPython</th>\n",
       "      <th>PctKnowsPython</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>Sierra Leone</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Burundi</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saint Lucia</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Liechtenstein</td>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>60.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>North Korea</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Solomon Islands</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Timor-Leste</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Democratic People's Republic of Korea</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Eritrea</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Djibouti</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>183 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       NumRespondents  NumKnowsPython  \\\n",
       "Sierra Leone                                        1               1   \n",
       "Burundi                                             1               1   \n",
       "Saint Lucia                                         1               1   \n",
       "Liechtenstein                                       5               3   \n",
       "North Korea                                         4               2   \n",
       "...                                               ...             ...   \n",
       "Solomon Islands                                     1               0   \n",
       "Timor-Leste                                         1               0   \n",
       "Democratic People's Republic of Korea               2               0   \n",
       "Eritrea                                             1               0   \n",
       "Djibouti                                            1               0   \n",
       "\n",
       "                                       PctKnowsPython  \n",
       "Sierra Leone                                    100.0  \n",
       "Burundi                                         100.0  \n",
       "Saint Lucia                                     100.0  \n",
       "Liechtenstein                                    60.0  \n",
       "North Korea                                      50.0  \n",
       "...                                               ...  \n",
       "Solomon Islands                                   0.0  \n",
       "Timor-Leste                                       0.0  \n",
       "Democratic People's Republic of Korea             0.0  \n",
       "Eritrea                                           0.0  \n",
       "Djibouti                                          0.0  \n",
       "\n",
       "[183 rows x 3 columns]"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df.sort_values(by='PctKnowsPython',ascending=False,inplace=True)\n",
    "python_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NumRespondents</th>\n",
       "      <th>NumKnowsPython</th>\n",
       "      <th>PctKnowsPython</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>Sierra Leone</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Burundi</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saint Lucia</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>100.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Liechtenstein</td>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "      <td>60.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>North Korea</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Lesotho</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Niger</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Suriname</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Central African Republic</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Guyana</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>50.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Iceland</td>\n",
       "      <td>45</td>\n",
       "      <td>22</td>\n",
       "      <td>48.888889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>United States</td>\n",
       "      <td>20309</td>\n",
       "      <td>8324</td>\n",
       "      <td>40.986755</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Cuba</td>\n",
       "      <td>65</td>\n",
       "      <td>26</td>\n",
       "      <td>40.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Canada</td>\n",
       "      <td>3393</td>\n",
       "      <td>1340</td>\n",
       "      <td>39.493074</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Estonia</td>\n",
       "      <td>189</td>\n",
       "      <td>74</td>\n",
       "      <td>39.153439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Finland</td>\n",
       "      <td>521</td>\n",
       "      <td>203</td>\n",
       "      <td>38.963532</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Switzerland</td>\n",
       "      <td>1010</td>\n",
       "      <td>388</td>\n",
       "      <td>38.415842</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Ireland</td>\n",
       "      <td>554</td>\n",
       "      <td>210</td>\n",
       "      <td>37.906137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Kenya</td>\n",
       "      <td>194</td>\n",
       "      <td>73</td>\n",
       "      <td>37.628866</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Israel</td>\n",
       "      <td>1003</td>\n",
       "      <td>377</td>\n",
       "      <td>37.587238</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Ghana</td>\n",
       "      <td>76</td>\n",
       "      <td>28</td>\n",
       "      <td>36.842105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Trinidad and Tobago</td>\n",
       "      <td>20</td>\n",
       "      <td>7</td>\n",
       "      <td>35.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>United Kingdom</td>\n",
       "      <td>6221</td>\n",
       "      <td>2175</td>\n",
       "      <td>34.962225</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Slovenia</td>\n",
       "      <td>238</td>\n",
       "      <td>83</td>\n",
       "      <td>34.873950</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Singapore</td>\n",
       "      <td>376</td>\n",
       "      <td>129</td>\n",
       "      <td>34.308511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>France</td>\n",
       "      <td>2572</td>\n",
       "      <td>876</td>\n",
       "      <td>34.059098</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Australia</td>\n",
       "      <td>2018</td>\n",
       "      <td>686</td>\n",
       "      <td>33.994054</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>New Zealand</td>\n",
       "      <td>557</td>\n",
       "      <td>188</td>\n",
       "      <td>33.752244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Netherlands</td>\n",
       "      <td>1841</td>\n",
       "      <td>620</td>\n",
       "      <td>33.677349</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Chile</td>\n",
       "      <td>238</td>\n",
       "      <td>80</td>\n",
       "      <td>33.613445</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Turkmenistan</td>\n",
       "      <td>6</td>\n",
       "      <td>2</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Mongolia</td>\n",
       "      <td>21</td>\n",
       "      <td>7</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Guinea</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Mauritania</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Namibia</td>\n",
       "      <td>6</td>\n",
       "      <td>2</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Congo, Republic of the...</td>\n",
       "      <td>6</td>\n",
       "      <td>2</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Zambia</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>33.333333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Sweden</td>\n",
       "      <td>1164</td>\n",
       "      <td>387</td>\n",
       "      <td>33.247423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Germany</td>\n",
       "      <td>6459</td>\n",
       "      <td>2143</td>\n",
       "      <td>33.178511</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Uganda</td>\n",
       "      <td>67</td>\n",
       "      <td>22</td>\n",
       "      <td>32.835821</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Norway</td>\n",
       "      <td>565</td>\n",
       "      <td>184</td>\n",
       "      <td>32.566372</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Hong Kong (S.A.R.)</td>\n",
       "      <td>219</td>\n",
       "      <td>71</td>\n",
       "      <td>32.420091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Cameroon</td>\n",
       "      <td>34</td>\n",
       "      <td>11</td>\n",
       "      <td>32.352941</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Luxembourg</td>\n",
       "      <td>59</td>\n",
       "      <td>19</td>\n",
       "      <td>32.203390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Kyrgyzstan</td>\n",
       "      <td>22</td>\n",
       "      <td>7</td>\n",
       "      <td>31.818182</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Madagascar</td>\n",
       "      <td>19</td>\n",
       "      <td>6</td>\n",
       "      <td>31.578947</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Japan</td>\n",
       "      <td>361</td>\n",
       "      <td>113</td>\n",
       "      <td>31.301939</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Austria</td>\n",
       "      <td>788</td>\n",
       "      <td>245</td>\n",
       "      <td>31.091371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Italy</td>\n",
       "      <td>1535</td>\n",
       "      <td>475</td>\n",
       "      <td>30.944625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>Saudi Arabia</td>\n",
       "      <td>130</td>\n",
       "      <td>40</td>\n",
       "      <td>30.769231</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           NumRespondents  NumKnowsPython  PctKnowsPython\n",
       "Sierra Leone                            1               1      100.000000\n",
       "Burundi                                 1               1      100.000000\n",
       "Saint Lucia                             1               1      100.000000\n",
       "Liechtenstein                           5               3       60.000000\n",
       "North Korea                             4               2       50.000000\n",
       "Lesotho                                 2               1       50.000000\n",
       "Niger                                   2               1       50.000000\n",
       "Suriname                                2               1       50.000000\n",
       "Central African Republic                2               1       50.000000\n",
       "Guyana                                  2               1       50.000000\n",
       "Iceland                                45              22       48.888889\n",
       "United States                       20309            8324       40.986755\n",
       "Cuba                                   65              26       40.000000\n",
       "Canada                               3393            1340       39.493074\n",
       "Estonia                               189              74       39.153439\n",
       "Finland                               521             203       38.963532\n",
       "Switzerland                          1010             388       38.415842\n",
       "Ireland                               554             210       37.906137\n",
       "Kenya                                 194              73       37.628866\n",
       "Israel                               1003             377       37.587238\n",
       "Ghana                                  76              28       36.842105\n",
       "Trinidad and Tobago                    20               7       35.000000\n",
       "United Kingdom                       6221            2175       34.962225\n",
       "Slovenia                              238              83       34.873950\n",
       "Singapore                             376             129       34.308511\n",
       "France                               2572             876       34.059098\n",
       "Australia                            2018             686       33.994054\n",
       "New Zealand                           557             188       33.752244\n",
       "Netherlands                          1841             620       33.677349\n",
       "Chile                                 238              80       33.613445\n",
       "Turkmenistan                            6               2       33.333333\n",
       "Mongolia                               21               7       33.333333\n",
       "Guinea                                  3               1       33.333333\n",
       "Mauritania                              3               1       33.333333\n",
       "Namibia                                 6               2       33.333333\n",
       "Congo, Republic of the...               6               2       33.333333\n",
       "Zambia                                  9               3       33.333333\n",
       "Sweden                               1164             387       33.247423\n",
       "Germany                              6459            2143       33.178511\n",
       "Uganda                                 67              22       32.835821\n",
       "Norway                                565             184       32.566372\n",
       "Hong Kong (S.A.R.)                    219              71       32.420091\n",
       "Cameroon                               34              11       32.352941\n",
       "Luxembourg                             59              19       32.203390\n",
       "Kyrgyzstan                             22               7       31.818182\n",
       "Madagascar                             19               6       31.578947\n",
       "Japan                                 361             113       31.301939\n",
       "Austria                               788             245       31.091371\n",
       "Italy                                1535             475       30.944625\n",
       "Saudi Arabia                          130              40       30.769231"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df.head(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "NumRespondents    361.000000\n",
       "NumKnowsPython    113.000000\n",
       "PctKnowsPython     31.301939\n",
       "Name: Japan, dtype: float64"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "python_df.loc['Japan']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
